package basic_practice_1019;

import java.util.Scanner;
/**
 * @author MemoryC
 * */
public class Main {

	public static void main(String[] args) {

		Scanner scanner=new Scanner(System.in);
		
		while(scanner.hasNext()) {
			int n=scanner.nextInt();
			boolean hasBackable=false;
            for(int r=2;r<=16;r++) {
            	if(isBackable(Integer.toString(n,r))) {
            		hasBackable=true;
//            		System.out.println(r+":"+Integer.toString(n,r));
            		break;
            	}
            }
    		System.out.println(hasBackable?"Yes":"No");
		}
		scanner.close();
    }
	
	static boolean isBackable(String number) {
		
		int len=number.length();
		for(int i=0;i<len/2;i++) {
			if(number.charAt(i)!=number.charAt(len-1-i)) {
				return false;
			}
		}
		return true;
	}
}